package com.example.demo.ShiroConfig;

import org.apache.shiro.authc.UsernamePasswordToken;

/**
 * 自定义token类
 * 继承UsernamePasswordToken,
 * 账号密码登陆（password） 和 免密登陆（nopassword）
 * ClassName:CustomeToken
 * Package:com.example.demo.ShiroConfig
 * Description:
 *
 * @date:2020/3/20 9:13
 * @author:
 */
public class CustomeToken extends UsernamePasswordToken {
    private static final long serialVersionUID = -2564928913725078138L;

    private LoginType type;


    public CustomeToken() {
        super();

    }


    public CustomeToken(String username, String password, LoginType type, boolean rememberMe, String host) {
        super(username, password, rememberMe, host);
        this.type = type;
    }

    /**
     * 免密登录
     */
    public CustomeToken(String username,LoginType type) {
        super(username, "", false, null);
        this.type = LoginType.NOPASSWD;
    }

    /**
     * 账号密码登录
     */
    public CustomeToken(String username, String password,LoginType type) {
        super(username, password, false, null);
        this.type = LoginType.PASSWORD;
    }

    public LoginType getType() {
        return type;
    }


    public void setType(LoginType type) {
        this.type = type;
    }
}
